//STACK.CPP
//Stack class
#include<string.h>

struct stacknode
{ char locctr[6];
  char label[10];
  char mnemonic[6];
  char operand[10];

};

class stack
{
 private:
  int top;
  stacknode line[50];

 public:
  stack() 		{top=0;}
int push(char *loc,char* lab,char* mnemo,char* opr)
   {
     if(top<49)
      {
       top++;

       strcpy(line[top].locctr,loc);
       strcpy(line[top].label,lab);
       strcpy(line[top].mnemonic,mnemo);
       strcpy(line[top].operand,opr);
       return(1);
       }
     else
       {return(0);} //Full
   }

int pop(char *loc,char* lab,char* mnemo,char* opr)
   { if(top==0) return(0);
     else
     {
      strcpy(loc,line[top].locctr);
      strcpy(lab,line[top].label);
      strcpy(mnemo,line[top].mnemonic);
      strcpy(opr,line[top].operand);
      top--;
      return(1);
     }
    }
int isempty()
   { if(top==0) return(1);
     else return(0);
    }

};

